UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sKZ2QxYFm9heZhJw2FpkAiue3msPYPSz5yjoXYtg84A='
WHERE
key_id = 'd5b4b4fd088dfadaa490d0988367899fd251233644aa051417042be448b3a392'
AND (
token = 'sKZ2QxYFm9heZhJw2FpkAiue3msPYPSz5yjoXYtg84A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)