UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7SzDZinwe57fpib4tuCri/eWyKGWfB1YVJMgdbzgkUE=' 
WHERE 
  key_id = 'cd8a73dd2c1c82c1667268697b3da0d4a258a8e29f85c7e073f7799267478309' 
  AND (
    token = '7SzDZinwe57fpib4tuCri/eWyKGWfB1YVJMgdbzgkUE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037