UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'jV8/osivCiWgWK0qrd8gCyy+GC2fKpI4FYkS5N+bsY8='
WHERE
key_id = 'f1a7bcf9faf08a9914ad7b906e35ebfc47c17862647bf21bbf54baffdb15a232'
AND (
token = 'jV8/osivCiWgWK0qrd8gCyy+GC2fKpI4FYkS5N+bsY8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)