UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X0PR1ADchBv9Sqkfe8rgTNH1ONAzBPz6XUT2PUiP/SQ=' 
WHERE 
  key_id = 'e31adb3f51448a2cae250a5f8fe15fa2267b419c755e082df88e081476b3974b' 
  AND (
    token = 'X0PR1ADchBv9Sqkfe8rgTNH1ONAzBPz6XUT2PUiP/SQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034