UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Hlv2QXuAVNehYJGivEhLr21iL1dMidUVyxtCWsX1TOE='
WHERE
key_id = '6b907051de9a3d11d27ff41662b4412bb68c71d3c839e8d815713ff922ecba35'
AND (
token = 'Hlv2QXuAVNehYJGivEhLr21iL1dMidUVyxtCWsX1TOE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)