UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cz+YO4XE6vaDQo1dOeSVjIGA8lQZtRmj1SI31yZXf/Y=' 
WHERE 
  key_id = '4fba833d423da3f3d8de57754bfa69be6d8a673eb3b54f908ba5a507e009f2f6' 
  AND (
    token = 'cz+YO4XE6vaDQo1dOeSVjIGA8lQZtRmj1SI31yZXf/Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036