UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'da0Ygl4epZB9phVi4g6bkCONkqhUII8O6wvZVyX8PNE=' 
WHERE 
  key_id = 'b2661c0781436e304703578552b09baaf979aa8d03c68c61cb5c72d4ef4d6c3a' 
  AND (
    token = 'da0Ygl4epZB9phVi4g6bkCONkqhUII8O6wvZVyX8PNE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037