UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7J9FcgJM7pddxA9SiiFXI+shPE5N2SqGP8U1tkxxf9o='
WHERE
key_id = 'b16d12f8cf7283be630869623450bca8551b73ca67e9b8dedf42418654c509ed'
AND (
token = '7J9FcgJM7pddxA9SiiFXI+shPE5N2SqGP8U1tkxxf9o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)