UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JhEIQvBLf5/Kw8KYSeOTQEkN+7Ph/vWRzEUFKa1SJKw=' 
WHERE 
  key_id = 'f16f8cd65dc7d5e032f6a2229438633cefb6a2a96b61d002f22c548ed418e45f' 
  AND (
    token = 'JhEIQvBLf5/Kw8KYSeOTQEkN+7Ph/vWRzEUFKa1SJKw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037