UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cOFscyJNYn04NUe8aYZyJaLpOXE2EUPpVsfgGyPQE8w='
WHERE
key_id = 'c7c25c4cb561cce3f02603446d4ec1d9679e648e1ac15bdbcf939db3fda61706'
AND (
token = 'cOFscyJNYn04NUe8aYZyJaLpOXE2EUPpVsfgGyPQE8w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)