UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QwrutBJKWvBCuY5iCKN6/+amQrzU0w5d0Tk1kl+BSb0='
WHERE
key_id = 'cd3bb06eb11e60721b815b3e000608dfc41764223f960407cf29f4ced5fb4a29'
AND (
token = 'QwrutBJKWvBCuY5iCKN6/+amQrzU0w5d0Tk1kl+BSb0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)