UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mjW3ImJ4vGEF8xCYei9CtWECbyde004pXryi+VnPJ7M=' 
WHERE 
  key_id = '190b17ac86294e2d2b2bc98ffb84931b28acb6501737a1424c8ab45756a4c8e8' 
  AND (
    token = 'mjW3ImJ4vGEF8xCYei9CtWECbyde004pXryi+VnPJ7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044