UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v8Lhahr8Duz3WprZToKsWx8+WLaHUJjbUTRgUUyMoH4=' 
WHERE 
  key_id = '1d45f7de7b7c00e8d8ef2c0b64f6c2e09aac09cc3a64b1e826f1188cb597eb47' 
  AND (
    token = 'v8Lhahr8Duz3WprZToKsWx8+WLaHUJjbUTRgUUyMoH4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027