UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ccd6f9vw75dF2HE8DRKN3LtJJUBDYtoyIHIB6IC+qa4='
WHERE
key_id = 'ab0705f5dee2b9419749ca4edd3003bb3c6f371b9692dbdec85b70559ea39cad'
AND (
token = 'ccd6f9vw75dF2HE8DRKN3LtJJUBDYtoyIHIB6IC+qa4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)