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