UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R7HYzDtFiYLuvPepjJHk03e4dL0ueGwatVDWiwJ1xEw='
WHERE
key_id = '5c52cea0a0366ebd9cb516fa86c1c3e8e8947eb1c76a7cc46eb99440e64f56c2'
AND (
token = 'R7HYzDtFiYLuvPepjJHk03e4dL0ueGwatVDWiwJ1xEw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)