UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7A+K8P4QkZq7Itbg29bPGK280MouI3Houvsm861bLV8='
WHERE
key_id = '7143df62d6ce3fa80d2bd182436e25531663c1fd4425faf45f94083c6fc24367'
AND (
token = '7A+K8P4QkZq7Itbg29bPGK280MouI3Houvsm861bLV8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)