UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'JTWDI3A1ikqieqtEOQvTUhNXjryrBIUhCCJlQUWixbo='
WHERE
key_id = '4a20024c8cc6bd4539ec7c4e61407efdccff51a09739c52286c9b2035fb7b202'
AND (
token = 'JTWDI3A1ikqieqtEOQvTUhNXjryrBIUhCCJlQUWixbo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)