UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'oypRDuqT1/ZyLAGnw6Z//fL5EWx/FjWuWl05aRY1wwc=' 
WHERE 
  key_id = '39dd70a45502e22db45ca538b09678d558ae5c713e1353fa4f10fdef35343137' 
  AND (
    token = 'oypRDuqT1/ZyLAGnw6Z//fL5EWx/FjWuWl05aRY1wwc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026