UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xBxaNloN9Dhtme2dNit0B3BxExotJR39xAio2JWilPU=' 
WHERE 
  key_id = '300520951ae2b341f26a3ec582405fa39a7ded4f048088a156d68fc2c55c4738' 
  AND (
    token = 'xBxaNloN9Dhtme2dNit0B3BxExotJR39xAio2JWilPU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082