UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zOog/tDam4x5qdxttiliIQmJhCHPmepXSExmjEQLOe8=' 
WHERE 
  key_id = '4bbe49a70a60de37d35e675d35746c56e425405ae87683c230868bc787e4d4e4' 
  AND (
    token = 'zOog/tDam4x5qdxttiliIQmJhCHPmepXSExmjEQLOe8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031