UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dY8ftSHZIXEzabfnzw219k6QZfgrdhEVK4RvftcZFyg=' 
WHERE 
  key_id = '294a93ef2c8a625425c192257a78009e112ea09a06ed70c8b3a0e27d9b50c2f5' 
  AND (
    token = 'dY8ftSHZIXEzabfnzw219k6QZfgrdhEVK4RvftcZFyg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048