UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nYvabKZzEjRLjLHVX/oH/HKpQt8d1B9yX5IrN4dhcx4=' 
WHERE 
  key_id = '63afbc5e9135274b793ba83c30b47fdd20636c72ac4635049efaf0f813261131' 
  AND (
    token = 'nYvabKZzEjRLjLHVX/oH/HKpQt8d1B9yX5IrN4dhcx4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035