UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JcqvD52cs8djAc92aE+P+epPRkB3DGYkHkYw3J3ijlY='
WHERE
key_id = 'beb0a45fb3783f891cc8804d62aeb9d23f1c5200f19eccf0168fd4935239515c'
AND (
token = 'JcqvD52cs8djAc92aE+P+epPRkB3DGYkHkYw3J3ijlY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)