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