UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+SV44lZyQ8e6X6FLeDnKJanC/KnSB65B/cSHNIcUtdM=' 
WHERE 
  key_id = '2fd7a274ddb146e96545deac98b969af4331e7d07a90f6198ccb1640bb53b776' 
  AND (
    token = '+SV44lZyQ8e6X6FLeDnKJanC/KnSB65B/cSHNIcUtdM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034