UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0R/XTjXwOYyY1y00xLe7M29tc+I0ehO22IBLaPATPus=' 
WHERE 
  key_id = 'ef89ef85befc0df1285f1df39f8cbd2609a8a1143e97fc6d466eb836574f88f3' 
  AND (
    token = '0R/XTjXwOYyY1y00xLe7M29tc+I0ehO22IBLaPATPus=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020