UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd0qeNO3d3V25GuYEAZ643HdNAOSkpfUNnsnlxFD6zJE='
WHERE
key_id = '6f0ed8af3094e7a7d7662bdd0d5f97785d22d3eab2da76327b26d953a0eb34b5'
AND (
token = 'd0qeNO3d3V25GuYEAZ643HdNAOSkpfUNnsnlxFD6zJE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)