UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4rjW301Vkl3liDXs5s/cShopt+g6R01QHn21kjOGh+I=' 
WHERE 
  key_id = 'bbdc53b9781f426cb7438b7542e96bf805d2b8770fdd91cc13afa73e95df6438' 
  AND (
    token = '4rjW301Vkl3liDXs5s/cShopt+g6R01QHn21kjOGh+I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037