UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'o0Rac2/mpF0WcjfddVCwUn+wfMIqvY0J9fKD94qxlG0='
WHERE
key_id = 'caee322222eb4e42330c414c03c2d269c36bb8961a01758f8a07bacb284b5738'
AND (
token = 'o0Rac2/mpF0WcjfddVCwUn+wfMIqvY0J9fKD94qxlG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)