UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IY9AZjdKsuiU2LK2+3tpbdLXFc6/PaSK2iChuzVAfv8='
WHERE
key_id = '54dd593a048434a73c00663415996b1a87d53e4148598d193e2c71d2a9c74f3d'
AND (
token = 'IY9AZjdKsuiU2LK2+3tpbdLXFc6/PaSK2iChuzVAfv8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)