UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4iVSwDMBzm1YyosMGF8lMNpluJkqzos97rxK8i8FmKE=' 
WHERE 
  key_id = '84fe50d46ac78e3c90495e4db48b947f96e2e9718667dfbed73e4b8516fe3604' 
  AND (
    token = '4iVSwDMBzm1YyosMGF8lMNpluJkqzos97rxK8i8FmKE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031