UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N/U1bNKJBpkEojBYjr2Tak4LMJyHoxrvaIFq06hJvnQ='
WHERE
key_id = 'c07e80e060518229aa5e9354b8735e16fd2a604dcbcc6ee5a61234644375018c'
AND (
token = 'N/U1bNKJBpkEojBYjr2Tak4LMJyHoxrvaIFq06hJvnQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)