UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KyDnj6C9UlO79zPv53MSjsG5ylqhR8Psn3gGVMFd+R8='
WHERE
key_id = '9125f6ead8d2fff240631d49844874581675fcf59a4751f03919377bde20e978'
AND (
token = 'KyDnj6C9UlO79zPv53MSjsG5ylqhR8Psn3gGVMFd+R8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)