UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cuC/f4X5vhh0CKXQ1R4tSFY5cg59ksM1dKyeyr0EPx0='
WHERE
key_id = 'debb5e5ca13d4103d9ec02cc8670e8bbae1d0134d66cf5b10002da969e267422'
AND (
token = 'cuC/f4X5vhh0CKXQ1R4tSFY5cg59ksM1dKyeyr0EPx0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)