UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AF/Dgid/8CjFC2ZyfdFeVLKqe0heplN/m74TIVtHw7s='
WHERE
key_id = 'ec5bdcbdff034566866bbe56a7c961fdc7c5e9987f32f65706a130bfeffe862b'
AND (
token = 'AF/Dgid/8CjFC2ZyfdFeVLKqe0heplN/m74TIVtHw7s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)