UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'R8bCkIaROYYTiuUYTjEqGgka6xcpUAd5evjtGRDRu+4=' 
WHERE 
  key_id = 'e700a3b413bdb1bf09b577e7a222b079d11cdcd2d626d453c5bf2b9bc845c25d' 
  AND (
    token = 'R8bCkIaROYYTiuUYTjEqGgka6xcpUAd5evjtGRDRu+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028